/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.oracleandsxnd.erp.member.web;

import com.oracleandsxnd.erp.common.persistence.Page;
import com.oracleandsxnd.erp.common.persistence.TableSplitResult;
import com.oracleandsxnd.erp.common.web.AjaxResult;
import com.oracleandsxnd.erp.common.web.BaseController;
import com.oracleandsxnd.erp.member.entity.Member;
import com.oracleandsxnd.erp.member.entity.MemberMoneyGive;
import com.oracleandsxnd.erp.member.service.MemberMoneyGiveService;
import com.oracleandsxnd.erp.member.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 会员充值Controller
 * @author 会员充值
 * @version 2019-12-14
 */
@Controller
@RequestMapping(value = "member_memberMoneyGive")
public class MemberMoneyGiveController extends BaseController {

	@Autowired
	private MemberMoneyGiveService memberMoneyGiveService;
	@Autowired
	private MemberService memberService;
	@RequestMapping(value = {""})
	public String list(MemberMoneyGive memberMoneyGive, HttpServletRequest request, HttpServletResponse response, Model model) {
		List<Member> memberCategorys= memberService.findList(new Member());
		model.addAttribute("members",memberCategorys);
		return "erp/member/memberMoneyGiveList";
	}

	@RequestMapping(value = {"listData"})
	@ResponseBody
	public Object listData(MemberMoneyGive memberMoneyGive , HttpServletRequest request, HttpServletResponse response){
		Page<MemberMoneyGive> page = memberMoneyGiveService.findPage(new Page<MemberMoneyGive>(request, response), memberMoneyGive);
		TableSplitResult<MemberMoneyGive> result=new TableSplitResult<MemberMoneyGive>(page.getPageNo(), page.getCount(), page.getList());
		return  result;
	}
	@RequestMapping(value = {"mx"})
	public String mx(MemberMoneyGive memberMoneyGive, HttpServletRequest request, HttpServletResponse response, Model model) {

		return "erp/member/memberMoneyGivemxList";
	}
	@RequestMapping(value = {"tj"})
	public String tj(MemberMoneyGive memberMoneyGive, HttpServletRequest request, HttpServletResponse response, Model model) {

		return "erp/member/memberMoneyGivetjList";
	}
	@RequestMapping(value = {"tjlistData"})
	@ResponseBody
	public Object tjlistData(MemberMoneyGive memberMoneyGive , HttpServletRequest request, HttpServletResponse response){
		Page<MemberMoneyGive> page = memberMoneyGiveService.findtjPage(new Page<MemberMoneyGive>(request, response), memberMoneyGive);
		TableSplitResult<MemberMoneyGive> result=new TableSplitResult<MemberMoneyGive>(page.getPageNo(), page.getCount(), page.getList());
		return  result;
	}
	@RequestMapping(value = "save")
	@ResponseBody
	public AjaxResult save(MemberMoneyGive memberMoneyGive) {

		try {
			memberMoneyGiveService.save(memberMoneyGive);
		} catch (Exception e) {
			e.printStackTrace();
			return  error(e.getMessage());
		}
		return success();
	}


}